package com.gserver.netty.domain;

import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;

import com.gserver.game.character.Player;

public class Message {
	private short handler;
	private short cmd;
	private ChannelHandlerContext ctx;
	private byte[] data;
	private Player player;

	public Message() {
	}

	public Message(short handler, short cmd, byte[] data,
			ChannelHandlerContext ctx) {
		this.handler = handler;
		this.cmd = cmd;
		this.ctx = ctx;
		this.data = data;
	}

	public Message(short handler, short cmd, byte[] data) {
		this.handler = handler;
		this.cmd = cmd;
		this.data = data;
	}

	public Message(short handler, short cmd) {
		this.handler = handler;
		this.cmd = cmd;
	}

	public short getHandler() {
		return handler;
	}

	public void setHandler(short handler) {
		this.handler = handler;
	}

	public short getCmd() {
		return cmd;
	}

	public void setCmd(short cmd) {
		this.cmd = cmd;
	}

	public byte[] getData() {
		return data;
	}

	public void setData(byte[] data) {
		this.data = data;
	}

	public ChannelHandlerContext getCtx() {
		return ctx;
	}

	public void setCtx(ChannelHandlerContext ctx) {
		this.ctx = ctx;
	}

	public Channel getChannel() {
		return ctx.getChannel();
	}

	public void send() {
		ctx.getChannel().write(this);
	}

	public Player getPlayer() {
		return player;
	}

	public void setPlayer(Player player) {
		this.player = player;
	}

}
